<?php 
function formatHS($hs)
{

	$segments[] = substr($hs, 0,4);
	$segments[] = substr($hs, 4,2);
	$segments[] = substr($hs, 6,2);
	$segments[] = substr($hs, 8,2);

	return implode('.',$segments);
}
function E($str){
	if(strlen($str)>0)
		return $str;
	return '-';
}
?>
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title></title>

	<style type="text/css">
	body,.importir table td{
		font-family: Arial;
		font-size: 12px;
	}
	table td{
		font-size: 12px !important;
	}
	table.rk {
		border: solid 2px #000;
		
	}
	td.rk1,td.rk2{
		width: 400px;
		font-weight: bold;
	}
	td.vat{padding-left: 183px}
	td.total{padding-left: 205px;font-weight: bold;}
	h3.h-title{
		color: blue;
	}
	div.content{
		padding: 1em;
	}
	div.importir{
		margin-top: 1em;
	}
	p.footer-text{
		background: #000;
		color: #fff;
		padding: 2px;
	}
	div.importir{

	}

	/**/
	div.header{
		text-align: center;
	}
	div.t1{
		font-size: 21px;
		font-weight: bold;
	}
	div.t2{
		font-style: italic;
		font-size: 18px;
	}
	div.t3,div.t4{
		font-size: 14px;
	}
	div.t5{
		font-weight: bold;
		text-align: right;
	}
	div.t6{
		text-align: right;
		font-style: italic;
	}
	div.coi-date{
		text-align: right;
	}
	div.coi-ttd{
		width:200px;
		
		text-align: center;
		margin-left:509px;
		font-weight: bold;
	}
	</style>
</head>
<body><style type="text/css">
.tl{
	text-align: left;
}
.tr{
	text-align: right;
}
.bc{
	border-collapse: collapse;
}
.bd{
	border: solid 1px #000;
}
.nr{
	border-top: solid 1px #000;
	border-bottom: solid 1px #000;
	border-left: solid 1px #000;
}
.nl{
	border-top: solid 1px #000;
	border-bottom: solid 1px #000;
	border-right: solid 1px #000;	
}
.bdt2{
	border-top-width: 2px;
}
.bdt2 th{
	background: #dedede;
	height: 40px;
}
.bdt2 td,.bdt2 th{
	/*font-size: 75%;*/
}
</style>
<div class="tr"><i><b>Report No. : <?php echo $tr->Nomor_COI?></b></i></div>
<b>Inspected Goods :</b>
<table class="bc bd bdt2" width="100%" cellpadding="4" colspacing="4">
<?php $no =1;$total_usd=0?>	
<tr>
	<th width="20px" valign="top">No.</th>
	<th class="nr tl" valign="top">Hs Code</th>
	<th class="nl tr" valign="top">Description Of Goods</th>
	<th class="bd" valign="top">Qty</th>
	<th class="bd" valign="top">Brand / Manufacturer</th>
	<th class="bd" valign="top">Model / Type</th>
	<th class="bd" valign="top">Serial No</th>
	<th class="bd" valign="top">Year Of <br/>Built</th>
	<th class="bd" valign="top">Country Of Origin</th>
	<th class="bd" valign="top">Value</th>
</tr>
<?php foreach($detail as $d):?>
<tr>
	<td class="bd" align="center"><?php echo $no++?>.</td>
	<td class="nr tl"><?php echo E(formatHS($d->HS))?></td>
	<td class="nl tr"><?php echo E($d->Deskripsi_Barang)?></td>
	<td class="bd" align="center"><?php echo $d->Jumlah . ' ' . $d->Satuan?></td>
	<td class="bd"><?php echo E($d->brand)?></td>
	<td class="bd"><?php echo E($d->model)?></td>
	<td class="bd"><?php echo E($d->serial_no)?></td>
	<td class="bd" align="center"><?php echo E($d->tahun)?></td>
	<td class="bd"><?php echo E($d->negara_pembuat)?></td>
	<td class="bd">USD <?php echo number_format($d->nilai_usd,2)?></td>
</tr>
<?php $total_usd += $d->nilai_usd?>
<?php endforeach?>
</table>	
<p><b><i>Total Value as per Document : GBP &nbsp;<?php echo number_format( $total_usd, 2 )?></i>

</b></p>
</body>
</html>